public class Test {
    public static void main(String[] args) {
        //层序遍历
        BinaryTree binaryTree = new BinaryTree();
        BinaryTree.TreeNode root = binaryTree.createTree();
        binaryTree.levelOrder(root);
        System.out.println();
        //判断是否为完全二叉树
        boolean flag = binaryTree.isCompleteTree(root);
        System.out.println(flag);
    }
    public static void main1(String[] args) {
        BinaryTree binaryTree = new BinaryTree();
        BinaryTree.TreeNode root = binaryTree.createTree();
        System.out.println(root.val);
        //前序
        binaryTree.preOrder(root);
        System.out.println();
        //中序
        binaryTree.inOrder(root);
        System.out.println();
        //后序
        binaryTree.postOrder(root);
        System.out.println();
        //层序
        //求节点个数size
        System.out.println("节点个数: ");
        binaryTree.size1(root);
        System.out.println(binaryTree.nodeNum);
        System.out.println(binaryTree.size2(root));
        //求叶子节点个数
        System.out.println("叶子节点个数: ");
        binaryTree.getLeafNodeCount1(root);
        System.out.println(binaryTree.leafSize);
        System.out.println(binaryTree.getLeafNodeCount2(root));
        //求第K层节点个数
        System.out.println("第K层节点个数: ");
        System.out.println(binaryTree.getKLevelNodeCount(root,3));
        //求树的高度
        System.out.println("树的高度: ");
        System.out.println(binaryTree.getHeight(root));
        //System.out.println(binaryTree.getHeight2(root));
//        //检测节点
//        System.out.println("查找节点: ");
//        System.out.println(binaryTree.find(root,'p').val);
    }
}
